<template>
  <div id="main">
    <el-config-provider :size="size" :locale="locales">
      <el-container>
        <el-aside width="auto">
          <!-- 左侧菜单组件-->
          <MenuBar :collapse="isCollapse" />
        </el-aside>
        <el-container>
          <el-header>
            <div class="header_frist">
              <!-- 头部折叠面包屑组件-->
              <HeaderBreadcrumb @change-collapse="isCollapse = $event" />
              <div class="frist_tools ">
                <!-- 头部工具栏全屏组件-->
                <FullScreen />
                <el-divider direction="vertical" />
                <!-- 头部工具栏字体切换组件-->
                <FontChange @change-size="size = $event" />
                <el-divider direction="vertical" />
                <!-- 头部切换语言组件-->
                <ChangeLanguage />
                <el-divider direction="vertical" />
                <!--头部显示头像组件-->
                <HeaderAvatar />
              </div>
            </div>
            <!-- 头部标签页右键菜单组件 -->
            <TagPart />
          </el-header>
          <!-- 显示导航栏内容 -->
          <el-main>
            <RouterView />
          </el-main>
        </el-container>
      </el-container>
    </el-config-provider>
  </div>
</template>
<script lang="ts" setup>
import { ref, computed } from 'vue'//引入响应式
import MenuBar from '@/components/MenuBar.vue' //引入左侧菜单组件
import HeaderBreadcrumb from '@/components/HeaderTools/HeaderBreadcrumb.vue' //引入头部面包屑组件
import TagPart from '@/components/TagPart.vue' //引入头部标签页右击菜单组件
import FullScreen from '@/components/HeaderTools/FullScreen.vue' //引入头部全屏组件
import FontChange from '@/components/HeaderTools/FontChange.vue' //引入头部字体切换组件
import ChangeLanguage from '@/components/HeaderTools/ChangeLanguage.vue' //引入头部切换语言组件
import HeaderAvatar from '@/components/HeaderTools/HeaderAvatar.vue' //引入头部显示头像组件
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import en from 'element-plus/es/locale/lang/en'
import { useI18n } from 'vue-i18n'

const isCollapse = ref(false) //声明折叠变量，默认不折叠
const size = ref('large')//声明标签页大小,默认large最大

const { locale} = useI18n()
const locales = computed(() => {//利用计算属性切换分页语言
  if ("zh" === locale.value) {
    return zhCn
  }
  return en
})
</script>

<style lang="less" scoped>
#main {

  width: 100%;
  height: 100vh;
  background-color: #fff;
  display: flex;
  justify-content: space-between;

  .el-aside {
    background-color: #304156;
  }

  .el-container {

    .el-header {
      width: 100%;
      height: 88px;
      line-height: 88px;
      background-color: #fff;
      position: relative;
      padding: 0;

      .header_frist {
        width: 100%;
        border-bottom: 1px solid #ccc;
        height: 50px;
        line-height: 50px;
        display: flex;

        .el-divider {
          margin: 20px 15px;
        }

        .frist_tools {
          width: 22%;
          height: 50px;
          line-height: 50px;
          display: flex;
          flex-wrap: nowrap;
          justify-content: space-between;
          background-color: #fff;
        }
      }
    }

    .el-main {
      width: 100%;
      border-top: 1px solid #ccc;
    }
  }
}
</style>
<style>
.el-main {
  --el-main-padding: 10px;
  display: block;
  flex: 1;
  flex-basis: auto;
  overflow: auto;
  box-sizing: border-box;
  padding: var(--el-main-padding);
}
</style>



